home *** CD-ROM | disk | FTP | other *** search
/ Total Web Page (Professional Suite) / Total Web Page 99.iso / CGI / BROWSER.PL < prev    next >
Perl Script  |  1996-06-03  |  1KB  |  40 lines

  1. #!/usr/bin/perl
  2. # Simple Browser Identification
  3. # Created by Matt Wright
  4. # Created on: 10/15/95          Last Modified on: 10/15/95
  5. # Version 1.0
  6. # Readme at bottom
  7.  
  8. ################################################################
  9. # Define Variables
  10.  
  11. $netscape_url = "http://your.host.xxx/netscape.html";
  12. $other_url = "http://your.host.xxx/other.html";
  13.  
  14. # Done
  15. ################################################################
  16.  
  17. $browser = "$ENV{'HTTP_USER_AGENT'}";
  18.  
  19. if ($browser =~ /Mozilla/) {   # If they are using Netscape browser
  20.    print "Location: $netscape_url\n\n";
  21. else {                         # For any other browser
  22.    print "Location: $other_url\n\n";
  23. }
  24.  
  25. # README - (anywhere below or at this line can be chopped out of this file)
  26. # This is a simple script which allows you to send users with a Netscape 
  27. # browser to a certain page, while others go to another page.
  28. # $netscape_url should be the url you want netscape users to go to.
  29. # $other_url should be the url you want other browsers to parse.
  30.  
  31. # This script could also be modified to state the browser name to those viewing
  32. # your page.  Simply chop out everything after the $browser = ""; line and 
  33. # replace it with:
  34.  
  35. #  print "Content-type: text/html\n\n";
  36. #  print "You are using $browser to view these pages!\n";
  37.  
  38. # Of course this example would most likely be used with server side includes.
  39.